//
//  FJC_VideoView.m
//  滴滴快拍
//
//  Created by dllo on 16/5/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "FJC_VideoView.h"


@interface FJC_VideoView ()

@end

@implementation FJC_VideoView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createView];
    }
    return self;
}


- (void)createView {
    UIView *topView = [[UIView alloc] init];
    topView.backgroundColor = [UIColor blackColor];
    [self addSubview:topView];
    [topView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(0);
        make.left.right.equalTo(self);
        }];
#warning mark masonry约束冲突
//        self.playerView = [[ZFPlayerView alloc] init];

    
    self.playerView = [[ZFPlayerView alloc] init];

//        self.playerView.backgroundColor = [UIColor redColor];
        [self addSubview:self.playerView];
        [self.playerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(0);
            make.left.right.equalTo(self);
//      注意此处，宽高比16：9优先级比1000低就行，在因为iPhone 4S宽高比不是16：9
            make.height.equalTo(self.playerView.mas_width).multipliedBy(7.0f / 6.0f).with.priority(667);
            
//            make.edges.insets(UIEdgeInsetsMake(0, 0, 0, 0));
        }];
    
// （可选设置）可以设置视频的填充模式，内部设置默认（ZFPlayerLayerGravityResizeAspect：等比例填充，直到一个维度到达区域边界）
    self.playerView.playerLayerGravity = ZFPlayerLayerGravityResizeAspect;
    // 打开断点下载功能（默认没有这个功能）
    self.playerView.hasDownload = YES;
    
    // 如果想从xx秒开始播放视频
    //self.playerView.seekTime = 15;

//    __weak typeof(self) weakSelf = self;
//    self.playerView.goBackBlock = ^{
//
//    
//    };

}



@end
